<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <a
      href="./a.html"
      id="link"
      data-username="jack"
      data-age="20"
      data-gender="boy"
      data-max-count="100"
      >a.html</a
    >
    <script>
      const link = document.getElementById("link");

      link.dataset.hobby = "css";
      link.dataset.username = "lucy";
      link.dataset.maxCount = "1000";
      link.dataset.minCount = "10";

      console.log(link.dataset);
      console.log(link.dataset.maxCount);
      console.log(link.dataset.username);
      console.log(link.dataset.age);
      console.log(link.dataset.gender);

      // link.setAttribute("data-username", "lili");
      // console.log(link.getAttribute("data-username"));
      // console.log(link.getAttribute("data-age"));
    </script>
  </body>
</html>
